package com.java.grammer.grammer;

import java.util.Scanner;

/**
 * @author luzhikun
 * @date 2020/11/28- 16:52
 */
public class watermelonTest {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入西瓜的重量");
        double a = sc.nextDouble();
        System.out.println("请输入你付的钱");
        double b = sc.nextDouble();
        double price = 0;
        if (a > 0 && a <= 4) {
            price = a * 0.8;
            double c = b - price;
            System.out.println("您的应付钱数为" + price + "  应找钱数为：" + c);
        } else if (a > 4 && a <= 6) {
            price = a * 0.6;
            double d = b - price;
            System.out.println("您的应付钱数为" + price + "  应找钱数为：" + d);
        } else if (a > 6 && a <= 8) {
            price = a * 0.4;
            double e = b - price;
            System.out.println("您的应付钱数为" + price + "  应找钱数为：" + e);
        } else if (a > 8 && a <= 10) {
            price = a * 0.3;
            double f = b - price;
            System.out.println("您的应付钱数为" + price + "  应找钱数为：" + f);
        } else if (a > 10) {
            price = a * 0.15;
            double g = b - price;
            System.out.println("您的应付钱数为" + price + "  应找钱数为：" + g);
        }
    }
}
